package cn.itsource.controller.admin;

import cn.dev33.satoken.annotation.SaIgnore;
import cn.itsource.result.R;
import cn.itsource.service.IDriverContractService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * 📖：beishan
 * 🗓️：2024/4/11 10:17
 * =====================
 */
@RestController
@RequestMapping("/admin/driver")
public class AdminController {
    @Autowired
    private IDriverContractService driverContractService;

//    @Operation(summary = "查看合同", description = "查看合同")
//    @PostMapping("/seecontract")
//    public R seecontract(@RequestBody ) {
//        driverContractService.changeStatus(id);
//        return R.success();
//    }

    @Operation(summary = "司机合同作废", description = "司机合同作废")
    @PostMapping("/changestatus/{id}")
    public R changeStatus(@PathVariable("id") Long id) {
        driverContractService.changeStatus(id);
        return R.success();
    }

    @Operation(summary = "协议上传", description = "协议上传")
    @RequestMapping("/upload")
    @SaIgnore
    public R upload(@RequestParam("uploadFile") MultipartFile uploadFile) {
        String upload = driverContractService.upload(uploadFile);
        return R.success(upload);
    }


}
